<%--
    Document   : MievaluacionAnterior
    Created on : 06/06/2011, 09:29:39 AM
    Author     : electro
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src="<%=request.getContextPath()%>/js/js/sevde.js"></script>
        <script type="text/javascript" src="<%=request.getContextPath()%>/js/js/prototype.js"></script>
        <script type="text/javascript" src="<%=request.getContextPath()%>/js/js/collapse.js"></script>
        <script language="javascript" type="text/javascript" src="<%=request.getContextPath()%>/js/jquery/jquery.js"></script>
        <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery/jquery.tablesorter.js"></script>
        <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery/jquery.tablesorter.pager.js"></script>
        <script type="text/javascript" src="<%=request.getContextPath()%>/js/js/util.js"></script>
        <link href="<%=request.getContextPath()%>/css/miestilo.css" rel="stylesheet" type="text/css">
        <link href="<%=request.getContextPath()%>/css/componentes.css" rel="stylesheet" type="text/css">
    </head>
    <body>
        <html:form styleId="form1" action="ConsultaAction">
            <input type="hidden" name="valSeleccionado" />
            <input type="hidden" name="namSeleccionado" />
        <table class="tablaingresos" border="0" >
            <tr>
                <td align="center">
                    <table  id="tb_opciones" class="tb_opciones" border="0"  >
                        <tr>
                            <td colspan="9" align="center" class="tituloJsp">
                                Historial de Desempeño
                            </td>
                        </tr>

                            <c:if test="${formulario != null}" >
                                <tr>
                                    <th><IMG class='stlTdImagen' border="1" SRC='file://fs-grupos/Data_pub$/PE/RRHH/fotos_HOC/<c:out value="${formulario.strID_EMPLEADO}" />.jpg' onerror="this.src='images/sinimagen.png';" /> </th>
                                    <th  rowspan="4" style="vertical-align: middle" >
                                        <table border="0" width="600px" cellpadding="2" cellspacing="2">
                                            <tr>
                                                <td  class="labelNombre" width="250px"><label><c:out value="${formulario.strNom_Empleado}" /></label></td>
                                            </tr>
                                            <tr>
                                                <td  class="labelopciones"><label><c:out value="${formulario.strApellido_Empleado}" /></label> </td>
                                                <td class="espaciosEnBlanco"></td>
                                            </tr>
                                            <tr>
                                                <td class="labelopciones" ><label   ><c:out value="${formulario.strPuesto_Empleado}" /></label></td>
                                            </tr>
                                            <tr>
                                                <td class="labelopciones"><label ><c:out value="${formulario.strArea_Empleado}" /></label> </td>
                                            </tr>
                                        </table>
                                    </th>

                                    <th class="espaciosEnBlanco"></th>
                                    <th rowspan="2">
                                        <table>
                                            <tr>
                                                <td>
                                                    <c:if test="${!empty requestScope.lstEvalAnterior}">
                                                        <button class="button" style="width: 83px"  type= "button" onclick="ejecutar();"> <img src="images/ejecutar1.gif" alt="" height="15px"/> Ejecutar</button>
                                                    </c:if>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <button  type= "button" style="width: 83px" class="button" onclick="cerrar();"> <img src="images/cerrar.gif" alt="" height="15px"/> Cerrar</button>
                                                </td>
                                            </tr>
                                        </table>
                                    </th>
                                </tr>
                            </c:if>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <HR>
                </td>

            </tr>

            <c:if test="${!empty requestScope.lstEvalAnterior}">

            <tr>
                <td>
                <table id="tableOne" cellspacing="1" align="center" border="0" style="width: 700px" >
                    <thead>
                        <tr>
                            <th width="1%"></th>
                            <th style="background: #1F497D ; color: #ffffff" class="labelpilares" width="6%"  height="18px"><div align="center">Periodo</div></th>
                            <th style="background: #1F497D ; color: #ffffff" class="labelpilares" width="15%" height="18px"><div align="center">Evaluador</div></th>
                            <th style="background: #1F497D ; color: #ffffff" class="labelpilares" width="20%" height="18px"><div align="center">Área</div></th>
                            <!--<th width="10%"><div align="center">Área</div></th>-->
                        </tr>
                    </thead>
                    <tbody>
                            <c:forEach items="${requestScope.lstEvalAnterior}" var="evalAnterior">
                                <c:if test="${evalAnterior.numeroOrden % 2 == 0}">
                                    <tr class="labelpilares" style="background-color: #B6DDE8">
                                </c:if>

                                <c:if test="${evalAnterior.numeroOrden % 2 != 0}">
                                    <tr style="background: #ffffff" height="18px" class="labelpilares">
                                </c:if>

                                    <td style="background: #EEEEEE" > <input type="checkbox"  id='<c:out value="${evalAnterior.periodo}"/>' name="chkPeriodo" onclick="setValor(this);desabilitarCheck(this.id);"  /> </td>
                                    <td><c:out value="${evalAnterior.periodo}"/></td>
                                    <td><c:out value="${evalAnterior.evaluador}"/></td>
                                    <td><c:out value="${evalAnterior.area}"/></td>
                                </tr>
                            </c:forEach>
                    </tbody>
                </table>
                </td>
            </tr>
            </c:if>

            <c:if test="${empty requestScope.lstEvalAnterior}">
                <tr>
                    <td>
                        <div align="center" class="label">NO SE ENCONTRARON REGISTROS</div><br>
                    </td>
                </tr>
            </c:if>
        </table>
        </html:form>
    </body>
    <script type="text/javascript" >
        function cerrar(){
            window.close();
        }

        function retornarHeight(h){
            var posicion_y;
            posicion_y=(screen.height/2)-(h/2);
            return posicion_y;
        }

        function retornarWidth(w){
            var posicion_x;
            posicion_x=(screen.width/2)-(w/2);
            return posicion_x;
        }

        function ejecutar(){
            var checkboxes = document.getElementsByName("chkPeriodo");
            var periodo = "";
            for (var x=0; x < checkboxes.length; x++) {
                if (checkboxes[x].checked) {
                    periodo = checkboxes[x].id
                }
            }

            if(periodo == ""){
                alert("Debe seleccionar un registro.");
            }
            else{
                //var url = '%=request.getContextPath()%>/ImprimirEvalAnterior?periodo='+periodo;
                var url = '<%=request.getContextPath()%>/ImprimirReporteConsolidado?periodo='+periodo;
                var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=800, height=800, top="+retornarHeight(800)+", left="+retornarWidth(800);
                //alert(url);
                window.open(url,"",opciones);
            }
        }

        function setValor(obj){
            if(obj.checked){
                document.forms[0].valSeleccionado.value = obj.parentNode.parentNode.id;
                document.forms[0].namSeleccionado.value = obj.name;
            }else{
                document.forms[0].valSeleccionado.value = "";
                document.forms[0].namSeleccionado.value = "";
            }
        }

    </script>
</html>
